package persistence;
import java.util.*;
import java.io.*;

public class HallTDG 
{
	
	public static ArrayList<HallFascade> FindAll()
	{
		ArrayList<HallFascade> HallsFascade = new ArrayList<HallFascade>(30);
		
		FileStorageRegistry.GetInstance().CheckFilesExist("src/halls.txt");
		
		File halls = new File("src/halls.txt");
		
			try 
			{
	        	BufferedReader reader = new BufferedReader(new FileReader(halls));
	        	String StaticIDCounter= reader.readLine();
	        	HallFascade.setID_Counter(Integer.parseInt(StaticIDCounter));	        	
	        	reader.readLine();
	        	String ID="";
	        	String RoomNumber="";
	        	String Capacity="";
	        	
	        	while(reader.ready())
	        	{
	        		ID = reader.readLine();
	        		RoomNumber = reader.readLine();
	        		Capacity = reader.readLine();
	        		
	        		HallsFascade.add( new HallFascade(Integer.parseInt(ID), RoomNumber, Integer.parseInt(Capacity)));
	        		
	        		reader.readLine(); //skips past '-' of txt file
	        	}
	        	
	        	reader.close();
	        } 
	        
	        catch (Exception e) 
	        {
	            System.err.println(e);
	            System.exit(1);
	        }
		
		
		return HallsFascade;
	}
}
